import IndexedDBRest from "./indexedDBRest";

const schema = {
  keypairs: "ownerCreditCode"
};

const indexedDBRest = new IndexedDBRest("CRBB", 1, schema, {});

export const storeKeypair = (keypair: any) =>
  indexedDBRest.create("keypairs", keypair).then((res: any) => res.result);

export const getKeypair = (ownerCreditCode: any) =>
  indexedDBRest
    .getOne("keypairs", ownerCreditCode)
    .then((res: any) => res.result);

export const deleteKeypair = (ownerCreditCode: any) =>
  indexedDBRest
    .delete("keypairs", ownerCreditCode)
    .then((res: any) => res.result);
